﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.Runtime.Serialization;
using System.Globalization;
using YasharEl.Infrastructure.ResourcesManagement;

namespace YasharEl.Infrastructure.OrgUnit
{
    [Serializable]
    public class EmployeeNotFoundException : TranslatedDomainModelException
    {
        private const string EmployeeNotFound = "EmployeeNotFound";

        private readonly long _employeeIdentityNumber;

        public long EmployeeIdentityNumber
        {
            get { return _employeeIdentityNumber; }
        }

        public EmployeeNotFoundException(IResourceManager resourceManager, long employeeIdentityNumber)
            : base
             (
                resourceManager,
                string.Format(
                    resourceManager.GetString(EmployeeNotFound, CultureInfo.GetCultureInfo("en")),
                    employeeIdentityNumber
                )
             )
        {
            _employeeIdentityNumber = employeeIdentityNumber;
        }

        protected EmployeeNotFoundException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        protected override string ExceptionMessageResourceKey
        {
            get { return EmployeeNotFound; }
        }

        public override string TranslatedMessage
        {
            get
            {
                return string.Format(resourceManager.GetString(ExceptionMessageResourceKey), EmployeeIdentityNumber);
            }
        }
    }
}
